package com.dis.resource.mapper;

import com.dis.pojo.entity.Policy;
import com.dis.pojo.queryDTO.PolicyPageQueryDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface PolicyMapper {

    /**
     * 插入数据
     * @param policy
     */
    void insert(Policy policy);

    /**
     * 分页查询
     * @param policyPageQueryDTO
     * @return
     */
    Page<Policy> pageQuery(PolicyPageQueryDTO policyPageQueryDTO);

    /**
     * 根据id删除
     * @param
     */
    void deleteById(@Param("policyId")Long policyId);

    /**
     * 更新
     * @param policy
     */
    void update(Policy policy);

    /**
     * 根据策略名称查询
     * @param policyName
     * @return
     */
    @Select("select * from policy where policy_name = #{policyName}")
    Policy getByPolicyName(String policyName);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from policy where policy_id = #{id}")
    Policy getById(Long id);
}
